package com.yzz.composeweatherproject.activity.viewpager2

import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentActivity
import androidx.viewpager2.adapter.FragmentStateAdapter

/**
 * @Author : yangzuozhe
 * @Time : On 2022/6/3 0:36
 *
 * @Description : ViewpagerAdapter
 */
class ViewpagerAdapter(fragmentActivity: FragmentActivity, private val list: MutableList<String>) :
    FragmentStateAdapter(fragmentActivity) {
    override fun getItemCount(): Int {
        return list.size
    }

    override fun createFragment(position: Int): Fragment {
        return ViewPagerFragment.newInstance(list.get(position))
    }
}